#import "YLButtonVC.h"
#import "YLButton.h"

@interface YLButtonVC ()
@property (weak, nonatomic) IBOutlet YLButton *btnTouch;
@property (weak, nonatomic) IBOutlet YLButton *btnDownload;
@end

@implementation YLButtonVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // 点击事件
    self.btnTouch.onPress = ^(YLButton *button) {
        [button setTitle:[NSString stringWithFormat:@"我是%td号按钮",button.tag] forState:UIControlStateNormal];
    };
    
    // 设置按钮的图片 From 网络
    self.btnDownload.onPress = ^(YLButton *button) {
        button.imageUrl = @"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1546595794798&di=a54aa7a6e5cb521c1f39aa5df176ede2&imgtype=0&src=http%3A%2F%2Fwww.miguyx.com%2Fwp-content%2Fuploads%2F2015%2F10%2F2015-10-1934.jpg";
        [button setTitle:@"" forState:UIControlStateNormal];
    };

}



@end
